package com.ylxl.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ylxl.common.utils.StringUtils;
import com.ylxl.entity.Areas;
import com.ylxl.entity.request.QueryChina;
import com.ylxl.mapper.AreasMapper;
import com.ylxl.service.IAreasService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 用户 业务层处理
 *
 */
@Service
public class AreasServiceImpl extends ServiceImpl<AreasMapper, Areas>  implements IAreasService {
    private static final Logger log = LoggerFactory.getLogger(AreasServiceImpl.class);

    @Autowired
    private AreasMapper areasMapper;


    @Override
    public List<Areas> selectList(QueryChina queryChina) {
        LambdaQueryWrapper<Areas> areasLambdaQueryWrapper = new LambdaQueryWrapper<>();
        areasLambdaQueryWrapper.eq(StringUtils.isNotEmpty(queryChina.getCityCode()),Areas::getCityCode,queryChina.getCityCode())
                .eq(StringUtils.isNotEmpty(queryChina.getRegionCode()),Areas::getRegionCode,queryChina.getRegionCode());
        return areasMapper.selectList(areasLambdaQueryWrapper);
    }
}
